package com.woniu34.search.controller;

import com.woniu.common.core.domain.AjaxResult;
import com.woniu34.search.domain.ActorSearch;
import com.woniu34.search.domain.CinemaSearch;
import com.woniu34.search.domain.MovieSearch;
import com.woniu34.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SearchController {



    @Autowired
    private SearchService searchService;


    @RequestMapping("es/cinema/list")
    public AjaxResult queryCinemaList(String searchKey){
        Page<CinemaSearch> cinemaSearches = searchService.queryCinemaList(searchKey);

        AjaxResult ajaxResult = AjaxResult.success(cinemaSearches);
        return ajaxResult;
    }

    @RequestMapping("es/actor/list")
    public AjaxResult queryActorList(String searchKey){
        Page<ActorSearch> actorSearches = searchService.queryActorList(searchKey);

        AjaxResult ajaxResult = AjaxResult.success(actorSearches);
        return ajaxResult;
    }

    @RequestMapping("es/movie/list")
    public AjaxResult queryMovieList(String searchKey){
        Page<MovieSearch> movieSearches = searchService.queryMovieList(searchKey);

        AjaxResult ajaxResult = AjaxResult.success(movieSearches);
        return ajaxResult;
    }
}
